Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dockerode

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dockerode

Docker Remote API module.

  • 3.3.5
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is dockerode?

dockerode is a Node.js module that provides a way to interact with Docker's Remote API. It allows you to manage Docker containers, images, networks, volumes, and more programmatically.

What are dockerode's main functionalities?

Manage Containers

This feature allows you to create and manage Docker containers. The code sample demonstrates how to create and start a container using the 'ubuntu' image.

const Docker = require('dockerode');
const docker = new Docker();

// Create a container
const createContainer = async () => {
  const container = await docker.createContainer({
    Image: 'ubuntu',
    Cmd: ['/bin/bash'],
    name: 'my-ubuntu-container'
  });
  await container.start();
  console.log('Container started');
};

createContainer();

Manage Images

This feature allows you to manage Docker images. The code sample demonstrates how to pull an image from Docker Hub.

const Docker = require('dockerode');
const docker = new Docker();

// Pull an image
const pullImage = async () => {
  await docker.pull('ubuntu', (err, stream) => {
    docker.modem.followProgress(stream, onFinished, onProgress);
    function onFinished(err, output) {
      console.log('Image pulled');
    }
    function onProgress(event) {
      console.log(event);
    }
  });
};

pullImage();

Manage Networks

This feature allows you to manage Docker networks. The code sample demonstrates how to create a network with the 'bridge' driver.

const Docker = require('dockerode');
const docker = new Docker();

// Create a network
const createNetwork = async () => {
  const network = await docker.createNetwork({
    Name: 'my-network',
    Driver: 'bridge'
  });
  console.log('Network created');
};

createNetwork();

Manage Volumes

This feature allows you to manage Docker volumes. The code sample demonstrates how to create a volume.

const Docker = require('dockerode');
const docker = new Docker();

// Create a volume
const createVolume = async () => {
  const volume = await docker.createVolume({
    Name: 'my-volume'
  });
  console.log('Volume created');
};

createVolume();

Other packages similar to dockerode

Keywords

FAQs

Package last updated on 12 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc